Migrate test setup to Vitest#1162
Merged
mweststrate merged 7 commits intoimmerjs:mainfrom Sep 12, 2025
Merged
Conversation
This was referenced Sep 8, 2025
mweststrate
approved these changes
Sep 12, 2025
Collaborator
|
This looks great, thanks for taking the effort! Since Github since still doesn't offer a rebase button, I'll just merge and fix up anything after |
Contributor
|
🎉 This PR is included in version 10.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've spent the last few days doing a significant amount of work trying to benchmark and improve Immer's performance, to address #1152 .
As part of that, I frequently needed to rerun the tests, but the current Jest + TS-Jest setup was annoyingly slow.
We switched over to use Vitest for the Redux repos a while back. I've been very happy with it, and part of that is that it seems to run our own tests noticeably faster.
I tried migrating Immer's tests to Vitest, and got them working. They also seem to run significantly faster. So, I'm submitting the Vitest migration as a PR in case you're interested.
Note that the work for this PR includes a lot of AI-generated code from Claude. This is a relatively new experiment for me, and I've done a lot of careful babysitting to keep it going in the right direction and tried to review and check the results.
Overall, the changes in this PR:
jestreferences tovipatch.js, as the existingrunPatchTestabstraction was resulting in Vitest thinking no tests were in the file. Created a similarrunPatchTestsmethod and updated all usages to call that method instead, and ensured that all tests are being run.describeblocks totestto ensure they're executed correctly